<%@page import="board.BoardVo"%>
<%@page import="board.Board"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>


<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Inzy's Board - Read</title>
<link rel="stylesheet" href="http://fonts.googleapis.com/earlyaccess/nanumgothic.css"/>
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet' type='text/css'>
<style>

#list_input {
	font-size: 14px;
	font-family: 'Nanum Gothic', sans-serif;
	background: #160952;
	color: white;
	border: 3px solid #160952;
	margin: 5px;
}

#board_pos {
	width: 700px;
	height: 470px;
	padding-top: 100px;
	font-size : 12px;
	background-color: transparent;
	color: white;
	font-size: 12px;
}

#board_main {
	background-size: 100%;
	background-image: url(../images/boardbg-2.png);
	width: 100%;
	height: 570px;
}


#list_title,#list_item {
	line-height: 180%; /* 줄 간격 */
	display: table-cell;
	font-family: 'Nanum Gothic', sans-serif;
	
}

#list_content {
	width: 600px;
	height: 230px;
	
	/* padding: 10px; */
}

#list_content textarea{
	font-family: 'Nanum Gothic', sans-serif;
}


/* #list_content {
	width: 580px;
	height: 150px;
	padding: 10px;
	text-align: left;
	font-size: 14px;
	color: black;
	background-color: yellow;
	font-family: 'Nanum Gothic', sans-serif;
}
 */
#list_title {
	width: 150px;
	background-color: #160952;
	color: white;
	font-family: 'Nanum Gothic', sans-serif;
	font-size: 14px;
}

#list_item {
	width: 450px;
	font-family: 'Nanum Gothic', sans-serif;
	font-size: 14px;
	color: black;
}

#list_line {
	width: 600px;
	height: 1px;
	
}

#list_item a:link, #list_item a:active, #list_item a:visited{
	color: black;
	text-decoration: none;
}
</style>

<script>
	function fileDownload(filename) {
		url = "../board2/filedownload.jsp?filename=" + filename;
		wind = window.open(url, "win", "");
	}
	
	function del(serial, filename){
		if(confirm("정말 삭제하시겠습니까?")){
			location.href="Main.jsp?inc_content=../board2/delete_result.jsp&serial="+serial+"&filename="+filename;
		}
	}
</script>

</head>
<body>

<jsp:useBean id="vo" class="board.BoardVo"></jsp:useBean>
	<jsp:setProperty property="*" name="vo" />
	<%
		Board b = new Board();
 		b.setVo(vo);
		BoardVo v = b.view();

	%>
	<div id='board_main'>
	<div align='center'>
		<div id='board_pos'>
			<div id='list_title'>글번호</div>
			<div id='list_item'><%=v.getSerial() %></div>
			<p />

			<div id='list_line'
				style='background-color: #dddddd;'></div>

			<div id='list_title'>조회수</div>
			<div id='list_item'><%=v.getHit() %></div>
			<p />

			<div id='list_line'
				style='background-color: #dddddd;'></div>

			<div id='list_title'>이름</div>
			<div id='list_item'><%=v.getMid() %></div>
			<p />

			<div id='list_line'
				style='background-color: #dddddd;'></div>

			<div id='list_title'>작성일</div>
			<div id='list_item'><%=v.getMdate() %></div>
			<p />

			<div id='list_line'
				style='background-color: #dddddd;'></div>

			<div id='list_title'>제목</div>
			<div id='list_item'><%=v.getSubject() %></div>
			<p />

			<div id='list_line'
				style='background-color: #dddddd;margin-bottom: 10px;'></div>

			<div id='list_content'>
				<textarea name="content" style="width: 100%; height: 100%;"><%=v.getContent() %>
				</textarea>
			</div>
			
			<div id='list_line'
				style='background-color: #dddddd;margin-top: 20px;'></div>
				
			<div id='list_title'>첨부파일</div>
			<div id='list_item'>
			<%
				if(v.getFilename() != null && v.getFilename() != ""){
			%>
				<a href="#" onClick="fileDownload('<%=v.getFilename()%>')"><%=v.getFilename() %></a>
				
			<%}else{ %>
				파일 없음.
			<%} %>	
			</div>

			<div id='list_line'
				style='background-color: #dddddd;'></div>
			<div id='list_line' style='background-color: #82B5DF;margin-bottom:10px'></div>

			<input type=button value="답글" id="list_input" OnClick="location.href='Main.jsp?inc_content=../board2/rep_register.jsp&serial=<%=v.getSerial()%>&grp=<%=v.getGrp()%>&deep=<%=v.getDeep()%>'">
			<input type=button value="목록" id="list_input" OnClick="location.href='Main.jsp?inc_content=../board2/list.jsp&part=<%=v.getPart()%>'">
			
			<%
				String id = (String)session.getAttribute("mid");
					if(id.equals(v.getMid())){
			%>
				<input type=button value="수정" id="list_input" OnClick="location.href='Main.jsp?inc_content=../board2/modify.jsp&serial=<%=v.getSerial()%>'">
				<input type=button value="삭제" id="list_input" OnClick="del('<%=v.getSerial() %>','<%=v.getFilename() %>');">
		
			<%} %>
		</div>
		</div>
	</div>
</body>
</html>

